using UnityEngine;

[RequireComponent(typeof(RuntimePath))]
public class PathEditor : MyEditor.PointEditor.PathEditorBase
{
    public PathNode[] pathNodes;

    private void Awake()
    {
        RefreshGameObjects();
        RuntimePath path = GetComponent<RuntimePath>();
        path.Initialize(this);
        for (int i = 0; i < pathNodes.Length; i++)
        {
            Destroy(pathNodes[i].gameObject);
        }
        Destroy(this);
    }

    public override void RefreshGameObjects()
    {
        pathNodes = GetComponentsInChildren<PathNode>();
        gameObjects = new GameObject[pathNodes.Length];
        for (int i = 0; i < gameObjects.Length; i++)
        {
            gameObjects[i] = pathNodes[i].gameObject;
        }
    }
}
